package com.ruoyi.comn.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.comn.mapper.ComnSalespersonMapper;
import com.ruoyi.comn.domain.ComnSalesperson;
import com.ruoyi.comn.service.IComnSalespersonService;

import javax.annotation.Resource;

/**
 * 销售人员管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-25
 */
@Service
public class ComnSalespersonServiceImpl implements IComnSalespersonService 
{
    @Resource
    private ComnSalespersonMapper comnSalespersonMapper;

    /**
     * 查询销售人员管理
     * 
     * @param salespersonUuid 销售人员管理主键
     * @return 销售人员管理
     */
    @Override
    public ComnSalesperson selectComnSalespersonBySalespersonUuid(String salespersonUuid)
    {
        return comnSalespersonMapper.selectComnSalespersonBySalespersonUuid(salespersonUuid);
    }

    /**
     * 查询销售人员管理列表
     * 
     * @param comnSalesperson 销售人员管理
     * @return 销售人员管理
     */
    @Override
    public List<ComnSalesperson> selectComnSalespersonList(ComnSalesperson comnSalesperson)
    {
        return comnSalespersonMapper.selectComnSalespersonList(comnSalesperson);
    }

    /**
     * 新增销售人员管理
     * 
     * @param comnSalesperson 销售人员管理
     * @return 结果
     */
    @Override
    public int insertComnSalesperson(ComnSalesperson comnSalesperson)
    {
        comnSalesperson.setCreateBy(SecurityUtils.getUsername());
        comnSalesperson.setCreateTime(DateUtils.getNowDate());
        return comnSalespersonMapper.insertComnSalesperson(comnSalesperson);
    }

    /**
     * 修改销售人员管理
     * 
     * @param comnSalesperson 销售人员管理
     * @return 结果
     */
    @Override
    public int updateComnSalesperson(ComnSalesperson comnSalesperson)
    {
        comnSalesperson.setUpdateBy(SecurityUtils.getUsername());
        comnSalesperson.setUpdateTime(DateUtils.getNowDate());
        return comnSalespersonMapper.updateComnSalesperson(comnSalesperson);
    }

    /**
     * 批量删除销售人员管理
     * 
     * @param salespersonUuids 需要删除的销售人员管理主键
     * @return 结果
     */
    @Override
    public int deleteComnSalespersonBySalespersonUuids(String[] salespersonUuids)
    {
        return comnSalespersonMapper.deleteComnSalespersonBySalespersonUuids(salespersonUuids);
    }

    /**
     * 删除销售人员管理信息
     * 
     * @param salespersonUuid 销售人员管理主键
     * @return 结果
     */
    @Override
    public int deleteComnSalespersonBySalespersonUuid(String salespersonUuid)
    {
        return comnSalespersonMapper.deleteComnSalespersonBySalespersonUuid(salespersonUuid);
    }
}
